package com.example.demo.mybatis.controller;

import com.example.demo.mybatis.model.Coffee;
import com.example.demo.mybatis.service.CoffeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author: YsCy丶
 * @Date: 2020/8/5 16:09
 */
@Controller
@RequestMapping("/coffee")
public class CoffeeController {

    @Autowired
    private CoffeeService coffeeService;

    @RequestMapping(value = "/",method = RequestMethod.GET)
    @ResponseBody
    public List<Coffee> getAll(){

        List<Coffee> allCoffee = coffeeService.findAllCoffee();

        return allCoffee;
    }
}
